home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-nudira.ads < prev    next >
Text File  |  1996-01-30  |  2KB  |  63 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --         A D A . N U M E R I C S . D I S C R E T E _ R A N D O M          --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.5 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18. with Ada.Finalization; use Ada.Finalization;
  19. with Ada.Numerics.Random;
  20.  
  21. generic
  22.    type Result_Subtype is (<>);
  23.  
  24. package Ada.Numerics.Discrete_Random is
  25.  
  26.    --  Basic facilities
  27.  
  28.    type Generator is limited private;
  29.  
  30.    function Random (Gen : Generator) return Result_Subtype;
  31.  
  32.    procedure Reset (Gen : in Generator);
  33.    procedure Reset (Gen : in Generator; Initiator : in Integer);
  34.  
  35.    --  Advanced facilities
  36.  
  37.    type State is private;
  38.  
  39.    procedure Save  (Gen : in  Generator; To_State   : out State);
  40.    procedure Reset (Gen : in  Generator; From_State : in  State);
  41.  
  42.    Max_Image_Width : constant := Ada.Numerics.Random.Max_Image_Width;
  43.  
  44.    function Image (Of_State    : State)  return String;
  45.    function Value (Coded_State : String) return State;
  46.  
  47. private
  48.  
  49.    package ANR renames Ada.Numerics.Random;
  50.  
  51.    type State is new ANR.State;
  52.  
  53.    type Access_State is access ANR.State;
  54.  
  55.    type Generator is
  56.       new Ada.Finalization.Limited_Controlled with record
  57.          State : Access_State := new ANR.State'(ANR.Make_State);
  58.       end record;
  59.  
  60.    procedure Finalize (Gen : in out Generator);
  61.  
  62. end Ada.Numerics.Discrete_Random;
  63.